package com.cosc716.restaurant.commands.customers;

import com.cosc716.restaurant.commands.Command;
import com.cosc716.restaurant.domain.CustomerGroup;
import com.cosc716.restaurant.domain.collections.WaitingQueue;
import com.cosc716.restaurant.system.Aggregator;

public class CommandAddCustomerGroupToQueue implements Command {
	
	private CustomerGroup group;
	
	
	public CommandAddCustomerGroupToQueue(CustomerGroup group) {
		super();
		this.group = group;
	}
	

	public CustomerGroup getGroup() {
		return group;
	}

	public void setGroup(CustomerGroup group) {
		this.group = group;
	}




	@Override
	public Object execute(Aggregator aggregator) {
		Boolean status;
		
		WaitingQueue queue =  aggregator.getWaitingQueue();
		if (queue.addCustomerGroup(group)) {
			status = new Boolean(true);
		}
		else {
			status = new Boolean(false);
		}
		
		return status;
	}

}
